package com.gozap.base;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class FileClock1SingleType {
	
	public static void main(String[] args) {

		FileClock1SingleType type=new FileClock1SingleType();
		FileClock1SingleType.SetClock clock = type.new SetClock();
		Thread thread=new Thread(clock);
		thread.start();
	}
	
	public SetClock getSetClock(){
		return new SetClock();
	}
	
	class SetClock implements Runnable{
		private String time="04:03";
		public void run() {
			
//				int day=Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
//				day==Calendar.THURSDAY
				while(true){
					System.out.println("in");
					Date date=Calendar.getInstance().getTime();
					String now=convertDateToString(date);
					System.out.println(now);
					if( now.endsWith(time) ){
						System.out.println("hhh");
						execute();
					}
					try {
						Thread.sleep(30000);
					} catch (Exception e) {
					}
				}
		}
		public String convertDateToString(Date date){
			String result="";
			SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm");
			result=format.format(date);
			return result;
		}
		public void execute(){
			try {
				String command="cmd /c start E:\\联系人导出\\蜡笔工具箱_导入联系人.jpg";
				//Process process=
				Runtime.getRuntime().exec(command);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
	}
}
